package
{
	import UI.Button;
	import UI.ScrollBarV;
	import UI.ScrollEvent;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.MouseEvent;
	
	public class TestButton extends Sprite
	{
		[Embed(source="./assets/button_demo.png")]
		private	var buttonImg:Class;
		
		[Embed(source="./assets/scrollBar.png")]
		private	var scrollBtnImg:Class;
		
		[Embed(source="./assets/scrollBar_bg.png")]
		private	var scrollBgImg:Class;
		
		[Embed(source="./assets/scrollBar_upArrow.png")]
		private	var scrollUpImg:Class;
		
		[Embed(source="./assets/scrollBar_downArrow.png")]
		private	var scrollDownImg:Class;
		
		public function TestButton()
		{
			super();
			this.stage.align = StageAlign.TOP_LEFT;
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			
			var buttonBg:Bitmap = new buttonImg();
			
			var button:Button = new Button(60, 21, buttonBg);
			button.text = "确 定";
			button.textColor = 0x2973BC;
			button.x = 20;
			button.y = 20;
			button.addEventListener(MouseEvent.CLICK, onClick);
			
			var scrollBtnPic:Bitmap = new this.scrollBtnImg();
			var scrollBgPic:Bitmap = new this.scrollBgImg();
			var scrollUpPic:Bitmap = new this.scrollUpImg();
			var scrollDownPic:Bitmap = new this.scrollDownImg();
			
			var scrollBar:ScrollBarV = new ScrollBarV(15, 200, scrollBtnPic, scrollBgPic,
				scrollUpPic, scrollDownPic);
			scrollBar.y = 50;
			scrollBar.x = 50;
			this.addChild(scrollBar);
			this.addChild(button);
			
			scrollBar.addEventListener(ScrollEvent.type, onScroll);
		}
		
		public	function	onScroll(evt:ScrollEvent):void{
			trace("pos="+evt.pos+",maxPos="+evt.maxPos);
		}
		
		public	function	onClick(evt:MouseEvent):void{
			trace("onClick");
		}
	}
}